<?php
    //设置字符编码
    header("content-type:text/html;charset=utf-8");

    //连接数据库
    $db = new mysqli("localhost","root","123456","shopping_center");

    //创建sql语句
    $sql = "SELECT * FROM user_information";

    //数据库对象执行语句
    $result = $db->query($sql);

    $arr = [];

    while( $row = $result->fetch_array( MYSQLI_ASSOC ) ){
        array_push( $arr,$row );
    }

    //转换成json字符串
    $json = json_encode( $arr );

    echo $json;
?>